package com.java.controller.admin;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.java.pojo.entity.BorrowInfo;
import com.java.pojo.vo.BorrowInfoApprovalVo;
import com.java.pojo.vo.BorrowerInfoVo;
import com.java.result.Result;
import com.java.service.BorrowInfoService;
import com.java.service.DictService;
import com.java.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

/**
 * <p>
 * 借款信息表 前端控制器
 * </p>
 *
 * @author Helen
 * @since 2021-07-08
 */

@Api("借款信息表")
@RestController
@RequestMapping("/admin/core/borrowInfo")
public class AdminBorrowInfoController {


    @Resource
    private BorrowInfoService borrowInfoService;



    //借款列表
    @ApiOperation("借款列表")
    @GetMapping("/borrowInfoList/{pageNum}/{pageSize}")
    public Result getBorrowInfoList(@PathVariable Integer pageNum,@PathVariable Integer pageSize){
        Page<BorrowerInfoVo> pageParam = new Page<BorrowerInfoVo>(pageNum, pageSize);
        IPage<BorrowerInfoVo> page= borrowInfoService.getBorrowInfoList(pageParam);
        return Result.ok(page);
    }

    //借款列表
    @ApiOperation("审批借款信息")
    @PostMapping("/approval")
    public Result approval(@RequestBody BorrowInfoApprovalVo borrowInfoApprovalVo){
        borrowInfoService.approval(borrowInfoApprovalVo);
        return Result.ok();
    }
}

